<?php
/**
 * Created by PhpStorm.
 * User: stupboy
 * Date: 2018/6/6
 * Time: 14:32
 * Mail:87658989@qq.com
 */

namespace app\adminapi\validate;

use app\base\validate\BaseValidate;

class Passenger extends BaseValidate
{
    protected $rule = [
        'passenger_id' => 'require',
        'company_id' => 'require|isPositiveInt',
        'user_id'    => 'require|min:0',
        'name'       => 'require|chs',
        'phone'      => 'require|length:11',
        'age'        => 'require|min:1',
        'birthday'   => 'require|date',
        'sex'        => 'require|between:1,2',
        'source'     => 'number|between:0,2',//0：公务员，1：企业员工，2：社会人员',
        'occupation' => 'chs|length:1,50',//职业
        'head_portrait' => 'length:1,100',
        'province'   => 'number',
        'city'       => 'number',
        'county'     => 'number',
        'unit'       => 'chs',//单位名称
        'department_id' => 'number|min:1',//部门id
        'id_number'  => 'require',//身份证
        'id_img'     => 'length:1,100',// 身份证图片
        'live_number'=> 'length:1,100',// 居住证
        'live_img'   => 'length:1,100',//居住证图片
        'card_number'=> 'length:10,30|number',//银行卡号
        'card_img'   => 'length:1,100',//银行卡图片
        'bank'       => 'chs',//银行
        'wechat'     => 'length:2,100',
        'alipay'     => 'length:2,100',
        'update_time'=> 'date',
        'email'      => 'length:3,30',
        'limit_id'   => 'length:1,100',// 单位端（用车权限；多种）
        'badge_number' => 'length:1,100',//工号
        'is_check'   => 'require',
        'is_instead' => 'require',
        'is_vip'     => 'require',
        'passenger_ids'=>'require',
        'state' => 'in:1,9',
    ];

    protected $default = [

    ];

    public $scene = [
        'add' => [
            'company_id','user_id','name','phone','age','birthday','sex','source','occupation','head_portrait','province','city','county','unit','department_id','id_number','id_img','live_number','live_img','card_number','card_img','bank','wechat','alipay','update_time','email','limit_id','badge_number','is_check','is_instead','is_vip','state',
        ],
        'edit' => [
            'passenger_id','company_id','user_id','name','phone','age','birthday','sex','source','occupation','head_portrait','province','city','county','unit','department_id','id_number','id_img','live_number','live_img','card_number','card_img','bank','wechat','alipay','update_time','email','limit_id','badge_number','is_check','is_instead','is_vip','state',
        ],
        'delete' => [
            'passenger_ids'
        ]
    ];
}